<!--
        该组件已被舍弃
-->

<template>
  <div>
    楼栋号：<el-input v-model="newHouse.building"></el-input><br><br>
    单元号：<el-input v-model="newHouse.unit"></el-input><br><br>
    房间号：<el-input v-model="newHouse.num"></el-input>
    <br><br>
    <div id="action" 
         align="right">
      <el-button type="success"
                 size="mini"
                 @click="cancel">取消</el-button>
      <el-button type="danger"
                 size="mini"
                 @click="commit">确定</el-button>
    </div>
  </div>
</template>

<script>
import http from '../../../axios_config'

export default {
  props: {
    chouse: {}//用来接收父组件传过来的数据
  },
  //当组件创建完毕之后自动调用此方法
  mounted () {
    console.log("updateHouse组件创建完毕");
    //js深拷贝
    //stringify  转换成json格式的字符串
    //parse   将字符串转换成JSON数据  对象
    this.newHouse = JSON.parse(JSON.stringify(this.chouse));
  },
  data () {
    return {
      newHouse: {},

    }
  },


  methods: {
    //  取消修改
    cancel () {
      //通知父组件关闭对话框
      this.$emit("closeUpdatedialog", { result: false, data: {} });
    },
    //提交修改
    commit () {
      //通知父组件关闭对话框
      console.info(this.newHouse)
      if (this.newHouse.building != "" && this.newHouse.unit != "" && this.newHouse.num != "") {
        console.log("信息完整");
        this.$emit("closeUpdatedialog", { result: true, data: this.newHouse });
      } else {
        console.log("信息不完整");
        this.$message('修改失败，请输入完整信息');
      }
    }
  }
}
</script>

<style scoped>
</style>